import {createRouter, createWebHistory, RouteRecordRaw,createWebHashHistory} from 'vue-router'
import Layout from '@/layout/home/index.vue'

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: 'index',
        component: Layout,
        redirect:'/dashed',
        children: [
            {
                path: 'dashed',
                name: 'dashed',
                component: () => import('@/views/dashed/index.vue'),
                meta: {title: '首页'}
            }
        ]
    },
    {
        path: '/system',
        name:'system',
        component: Layout,
        children: [
            {
                path: 'user',
                name: 'user',
                component: () => import('@/views/user/index.vue'),
                meta: {title: '用户管理'}
            },
            {
                path: 'role',
                name: 'role',
                component: () => import('@/views/role/index.vue'),
                meta: {title: '用户管理'}
            },
            {
                path: 'menu',
                name: 'menu',
                component: () => import('@/views/menu/index.vue'),
                meta: {title: '菜单管理'}
            }
        ]
    },
    {
        path: '/police',
        name:'police',
        component: Layout,
        redirect:'real',
        children: [
            {
                path: 'real',
                name: 'real',
                component: () => import('@/views/real/index.vue'),
                meta: {title: '实时报警'}
            },
            {
                path:'historys',
                name:'historys',
                component:()=>import('@/views/historys/index.vue'),
                meta:{title: "历史报警"}
            }
        ]
    }

]

const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router
